<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>koTime</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${ctx.contextPath}/static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctx.contextPath}/static/layui/css/global.css" media="all">
    <style>
        .site-doc-icon li{width: 222px;}
        .site-doc-icon li .layui-anim{width: 80px; height: 80px; line-height: 80px; margin: 0 auto 10px; text-align: center; background-color: #009688; cursor: pointer; color: #fff; border-radius: 50%;}
    </style>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
    <legend>koTime调用链路追踪</legend>
</fieldset>

<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <ul class="layui-tab-title">
        <li class="layui-this">总览</li>
        <li>接口列表</li>
        <li>联系我</li>
    </ul>
    <div class="layui-tab-content" style="height: 100px;">
        <div class="layui-tab-item layui-show">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                <legend>接口统计</legend>
            </fieldset>
            <ul class="site-doc-icon site-doc-anim">
                <li>
                    <div class="layui-anim" data-anim="layui-anim-up">${system.totalNum}</div>
                    <div class="code">接口数</div>
                </li>
                <li>
                    <div class="layui-anim" style=" <#if system.delayNum gt 0 >background-color: #da3f0b;</#if>" data-anim="layui-anim-upbit">${system.delayNum}</div>
                    <div class="code">延迟响应数</div>
                </li>
                <li>
                    <div class="layui-anim" data-anim="layui-anim-scale">${system.normalNum}</div>
                    <div class="code">正常响应数</div>
                </li>
            </ul>
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                <legend>响应统计</legend>
            </fieldset>
            <ul class="site-doc-icon site-doc-anim">
                <li>
                    <div class="layui-anim" style=" <#if system.avgRunTime gt config.timeThreshold >background-color: #da3f0b;</#if>" data-anim="layui-anim-up">${system.avgRunTime}</div>
                    <div class="code">平均响应（ms）</div>
                </li>
                <li>
                    <div class="layui-anim" style=" <#if system.maxRunTime gt config.timeThreshold >background-color: #da3f0b;</#if>" data-anim="layui-anim-upbit">${system.maxRunTime}</div>
                    <div class="code">最大响应（ms）</div>
                </li>
                <li>
                    <div class="layui-anim" style=" <#if system.minRunTime gt config.timeThreshold >background-color: #da3f0b;</#if>" data-anim="layui-anim-scale">${system.minRunTime}</div>
                    <div class="code">最小响应（ms）</div>
                </li>
            </ul>
            <ul>
                <blockquote class="layui-elem-quote">接口根据调用情况统计，未调用的接口无法被统计到，请先调用接口</blockquote>
            </ul>
        </div>

        <div class="layui-tab-item">
            <div class="layui-collapse" lay-filter="test">
                <#list list as runtime>
                <div class="layui-colla-item" >
                    <h2 class="layui-colla-title" id="${runtime.className}.${runtime.methodName}">
                        ${runtime.className}#${runtime.methodName}&nbsp
                        <span class="layui-badge <#if runtime.avgRunTime gt config.timeThreshold >layui-bg-red
                <#else>layui-bg-green
                </#if>">平均响应 ${runtime.avgRunTime} 毫秒</span>
                    </h2>
                    <div  class="layui-colla-content viewer" style="width: 98%;height:600px;">
                    </div>
                </div>
            </#list>
        </div>
    </div>

    <!--联系我-->
    <div class="layui-tab-item">

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
            <legend>@zhangchang#1729913829@qq.com</legend>
        </fieldset>
        <script src='https://gitee.com/huoyo/ko-time/widget_preview' async defer></script>
        <div id="osc-gitee-widget-tag"></div>
        <style>
            .osc_pro_color {color: #ffffff !important;}
            .osc_panel_color {background-color: #1e252b !important;}
            .osc_background_color {background-color: #323d47 !important;}
            .osc_border_color {border-color: #455059 !important;}
            .osc_desc_color {color: #d7deea !important;}
            .osc_link_color * {color: #99a0ae !important;}
        </style>
    </div>
</div>
</div>
</div>


<script src="${ctx.contextPath}/static/layui/layui.js" charset="utf-8"></script>
<script src="${ctx.contextPath}/static/jquery.min.js"></script>
<script src="${ctx.contextPath}/static/echarts.min.js"></script>
<script src="${ctx.contextPath}/static/config.js"></script>
<script >
    $(document).ready(function() {
        var threshold = "${config.timeThreshold}"
        layui.use(['element', 'layer'], function () {
            var element = layui.element;
            var layer = layui.layer;

            element.on('collapse(test)', function (data) {
                console.log(data)
                id = data.title['0'].id
                show(data.content['0'],id)
            });
        });

        function show(element,name) {
            var myChart = echarts.init(element);
            myChart.showLoading();
            $.get('${ctx.contextPath}/koTime/getTree?methodName=' + name, function (data) {
                // console.log(data)
                myChart.hideLoading();
                echarts.util.each(data.children, function (datum, index) {
                    index % 2 === 0 && (datum.collapsed = true);
                });
                myChart.setOption(option = getOption(data,threshold));
            });
            myChart.on('click',function (params) {
                console.log(params.componentType)
                console.log(params.seriesType )
                console.log(params)
            })

        }


        $('.site-doc-icon').delegate("li",'click', function(data){
        });
    })
</script>

</body>
</html>